/*
 * @Author: zhangxuanjiu 
 * @Date: 2018-01-18 14:47:08 
 * @Last Modified by: zhangxuanjiu
 * @Last Modified time: 2018-04-03 16:48:07
 */
import React from 'react'
import ReactDOM from 'react-dom'
import Manager from './component/Manager'
import Cookies from 'js-cookie'
global.Cookies = Cookies

global.fetchJson = (url, opt) => {
  const optAppend = Object.assign({
    headers: {
      Authorization: Cookies.get('token'),
      'Content-type': 'application/json'
    }
  }, opt)
  return fetch(url, optAppend).then(res => {
    if (res.ok) {
      return res.json()
    }
    throw new Error('network error')
  })
}

ReactDOM.render(
  <Manager>
  </Manager>,
  document.getElementById('root')
)

if (env === 'production') {
  document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
    WeixinJSBridge.call('hideOptionMenu')
  })
}